<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <a href="#a">测试</a>
  <a href="#b">测试</a>
  <a href="#c">测试</a>
  <script>
    // hashchange 是一个全局事件  hash 就是 URL 中的锚点
    window.addEventListener('hashchange', () => {
      //
      console.log('hash 值改变了啊~~');
    });

  </script>
</body>
</html>